package com.lans.graph;

/**
 * @author: lans
 * @date: 2025/3/9
 * @name: 刘宇
 */
public class DepthFirstSearchTest {
    public static void main(String[] args) {
        Graph graph = new Graph(13);
        graph.addEdge(0,5);
        graph.addEdge(0,1);
        graph.addEdge(0,2);
        graph.addEdge(0,6);
        graph.addEdge(5,3);
        graph.addEdge(5,4);
        graph.addEdge(3,4);
        graph.addEdge(4,6);
        graph.addEdge(7,8);
        graph.addEdge(9,11);
        graph.addEdge(9,10);
        graph.addEdge(9,12);
        graph.addEdge(11,12);

        DepthFirstSearch depthFirstSearch = new DepthFirstSearch(graph,0);
        int count = depthFirstSearch.count();
        System.out.println("与0点相通的顶点的数量count="+count);
        boolean marked1 = depthFirstSearch.marked(5);
        boolean marked2 = depthFirstSearch.marked(7);
        System.out.println("5是否与顶点相通"+marked1);
        System.out.println("7是否与顶点相通"+marked2);
    }
}